#include "Scene11.hpp"

Scene11::Scene11() {
    b2Vec2 vertices[8];
    vertices[0].Set(-9.0f, -8.0f);
    vertices[1].Set(9.0f, -8.0f);
    vertices[2].Set(9.0f, -6.0f);
    vertices[3].Set(7.0f, -6.0f);
    vertices[4].Set(7.0f, 8.0f);
    vertices[5].Set(-7.0f, 8.0f);
    vertices[6].Set(-7.0f, -6.0f);
    vertices[7].Set(-9.0f, -6.0f);

    this->createRoom(11, vertices, 8);

    b2Vec2 platformVertices[2];
    platformVertices[0].Set(-1.0f, -4.0f);
    platformVertices[1].Set(1.0f, -4.0f);

    this->createPlatform(platformVertices, 2);

    b2Vec2 platformVertices2[2];
    platformVertices2[0].Set(5.0f, -6.0f);
    platformVertices2[1].Set(7.0f, -4.0f);

    this->createPlatform(platformVertices2, 2);

    this->start = this->createDoor(-7.0f, -7.0f, -1.0f);
    this->createExit(8.0f, -7.0f);
    this->hero = this->createHero(-9.0f + HeroElement::WIDTH / 2.0f, -8.0f + HeroElement::HEIGHT / 2.0f);

    // Jumping box.
    this->createFlash(0.0f, -4.0f, 0.0f, b2Vec2(0.0f, 280.0f));
    this->createBox(0.0f, 7.0f)->body->SetAngularVelocity(1.0f);

    // Flashes to the jumping box.
    this->createFlash(1.0f, -8.0f, 0.0f, b2Vec2(200.0f, 200.0f));
    this->createFlash(7.0f, -3.0f, b2_pi / 2.0f, b2Vec2(-250.0f, 125.0f));
    this->createBox(-1.5f, -7.5f);

    // First exit door.
    DoorElement* firstExitDoor = this->createDoor(5.0f, -7.0f, 0.0f);
    this->createSwitch(-4.5f, -8.0f, 0.0f, firstExitDoor);

    // Second exit door.
    this->exit = this->createDoor(7.0f, -7.0f, 1.0f);
    this->createSwitch(-1.75f, -8.0f, 0.0f, this->exit);
}
